Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SAM 2.1 to the model zoo #4979

Merged
merged 3 commits into from
Oct 25, 2024
Merged

Conversation

prernadh
Copy link
Contributor

@prernadh prernadh commented Oct 24, 2024

What changes are proposed in this pull request?

(Please fill in changes proposed in this fix)

How is this patch tested? If it is not, please explain why.

(Details)

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

(Details in 1-2 sentences. You can just refer to another PR with a description
if this PR is part of a larger change.)
This PR adds in checkpoints for SAM2.1 models into the FiftyOne Model zoo.

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other: FiftyOne model zoo

Summary by CodeRabbit

  • Documentation
    • Improved logic for handling model applications in documentation generation, enhancing specificity for 'med-sam' and 'segment-anything' models.
    • Updated label and prompt fields for dataset model applications based on model type.

Copy link
Contributor

coderabbitai bot commented Oct 24, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (4)
  • develop
  • main
  • release/.*
  • feat/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request modifies the logic in the make_model_zoo_docs.py script, specifically within the _MODEL_TEMPLATE section. It reorganizes the conditional checks for model names and tags to apply the correct parameters for 'med-sam' and 'segment-anything' models. The updates include changes to the label and prompt fields for the dataset.apply_model function, ensuring appropriate model handling based on the updated conditions.

Changes

File Change Summary
docs/scripts/make_model_zoo_docs.py Reorganized conditional checks for model names and tags; updated label and prompt fields for 'med-sam' and 'segment-anything' models.

Possibly related PRs

  • Adding MedSAM2 to the model zoo #4828: This PR modifies the same script (docs/scripts/make_model_zoo_docs.py) and includes changes to the handling of the 'med-sam' model, which is directly relevant to the updates made in the main PR regarding model application logic for 'med-sam' and 'segment-anything' models.

Suggested reviewers

  • brimoor
  • jacobmarks

🐇 In the garden, where models play,
New logic blooms, brightening the day.
With tags and names, we set the scene,
For 'med-sam' and 'segment-anything' keen.
Let parameters dance, in perfect array,
As we hop along, in a joyful ballet! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@prernadh prernadh marked this pull request as draft October 24, 2024 11:02
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
docs/scripts/make_model_zoo_docs.py (2)

150-161: Enhance documentation clarity for med-sam model usage

The template provides good example code, but could benefit from additional clarity:

  1. Consider explaining why frame 100 is chosen as the reference frame.
  2. Add a note about the expected format of gt_detections to help users prepare their data correctly.
     # Retaining detections from a single frame in the middle
     # Note that SAM2 only propagates segmentation masks forward in a video
+    # Note: gt_detections should contain bounding box annotations in COCO format
     (
         dataset
         .match_frames(F("frame_number") != 100)

161-168: LGTM with a suggestion for documentation

The changes look good and maintain consistency with FiftyOne's field naming conventions. The comment about supporting both Detections and Keypoints is helpful.

Consider adding a brief example of how to use Keypoints as prompts, as this might not be immediately obvious to users:

     # Segment inside boxes and propagate to all frames
+    # Example with keypoints:
+    # dataset.apply_model(model, label_field="segmentations", prompt_field="frames.keypoints")
     dataset.apply_model(
         model,
         label_field="segmentations",
         prompt_field="frames.detections",  # can contain Detections or Keypoints
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 51d49e8 and 641ccba.

⛔ Files ignored due to path filters (1)
  • fiftyone/zoo/models/manifest-torch.json is excluded by !**/*.json
📒 Files selected for processing (1)
  • docs/scripts/make_model_zoo_docs.py (1 hunks)

docs/scripts/make_model_zoo_docs.py Show resolved Hide resolved
@brimoor brimoor force-pushed the prerna/add-sam2.1-checkpoints branch from 641ccba to 864b692 Compare October 24, 2024 19:37
@brimoor brimoor changed the base branch from develop to bug/model-zoo-docs October 24, 2024 19:40
@brimoor brimoor changed the title Adding SAM2.1 checkpoints Adding SAM 2.1 to the model zoo Oct 24, 2024
@brimoor brimoor marked this pull request as ready for review October 24, 2024 19:40
Copy link
Contributor

@brimoor brimoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from bug/model-zoo-docs to develop October 25, 2024 01:29
@brimoor brimoor merged commit dd5b472 into develop Oct 25, 2024
1 check passed
@brimoor brimoor deleted the prerna/add-sam2.1-checkpoints branch October 25, 2024 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants